package com.houger.ddd.seckill.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.houger.ddd.common.utils.R;
import com.houger.ddd.seckill.controller.vo.QueryActivityDetailResponse;
import com.houger.ddd.seckill.facade.ActivityAdminFacade;
import com.houger.ddd.seckill.controller.request.ActivityRequest;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

/**
 * @author Houger.
 * @date 2024年05月15日 10:39.
 */
@Slf4j
@RefreshScope
@Tag(name = "activity-admin")
@RestController
@RequestMapping("/activity-admin")
public class ActivityAdminController {

    @Resource
    ActivityAdminFacade activityAdminFacade;
    @PostMapping("create")
    @Operation(summary = "create", description = "创建/更新活动")
    public R<String> create(@RequestBody ActivityRequest request) throws Exception {
        return activityAdminFacade.save(request);
    }

    @PostMapping(value = "/query/{id}")
    @Operation(summary = "query", description = "查询活动详情")
    public R<QueryActivityDetailResponse> query(@PathVariable Long id){
        return R.ok(activityAdminFacade.queryDetail(id));
    }
    @PostMapping("/enable/{id}")
    @Operation(summary = "enable", description = "启用活动")
    public R<String> enable(@PathVariable Long id){
        return activityAdminFacade.enable(id);
    }

    @PostMapping("delete")
    @Operation(summary = "delete", description = "删除活动")
    public void delete(){
        log.info("s");
    }

    @PostMapping("copy")
    @Operation(summary = "copy", description = "复制活动")
    public void copy(){
        log.info("s");
    }



    @PostMapping("queryByPage")
    @Operation(summary = "queryByPage", description = "分页查询活动")
    public void queryPage(){
        log.info("s");
    }


}
